let arr=document.cookie.split(";");
let obj={};
for(let i=0;i<arr.length;i++){
  arr[i]=arr[i].replace(/(^\s*) | (\s*$)/g,"");
  obj[arr[i].split("=")[0]]=arr[i].split("=")[1];
}

import Vue from 'vue';
import VueX from 'vuex';
import cookies from 'js-cookie';
Vue.use(VueX);
// import '../../static/config.js';
export default new VueX.Store({
  state:{
    port:"http://192.168.0.11:8086/",
    system_name_cn:systemConfig.system_name_cn,
    system_name_en:systemConfig.system_name_en,
    screen_title_name:systemConfig.screen_title_name,
    advertiser_id:"1",
    isLoading:true,
    zoneCode:"",
    doError:false,//操作提示框
    errorAlert:false,//操作提示框
    isLoad:false,//是否登录
    id:0,
  },
  mutations:{
    setName(state,msg) {
      state.advertiser_id = msg;
    },
    setDoError(state,doError) {
      state.doError = doError;
    },
    setErrorAlert(state,errorAlert) {
      state.errorAlert = errorAlert;
    },
    setStatus(state,status){
      state.isLoading=status;
    },
    setUserName(state,userName){
      state.userName=userName;
    },
    setNodeId(state,nodeId){
      state.nodeId=nodeId;
    },
    setUserType(state,userType){
      state.userType=userType;
    },
    setDeviceId(state,deviceId){
      state.deviceId=deviceId;
    },
    setDeviceName(state,deviceName){
      state.deviceName=deviceName;
    },
    setDidNum(state,didNum){
      state.didNum=didNum;
    },
    setIsLoad(state,isLoad){
      state.isLoad=isLoad;
    },
    hideLoading () {
      this.state.isLoading=false;
    }
  }
});

